/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package jp.co.irep.juten.view;

import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.servlet.http.Part;

import javax.validation.constraints.Min;
import jp.co.irep.juten.entity.Product;

import org.hibernate.validator.constraints.NotBlank;

/**
 *
 * @author binh_dinh
 */
@Named
@SessionScoped
public class ProductViewBean implements Serializable {

    private int id;
    @Min(value = 1, message = "{validation.ProductBean.makerId.Min.message}")
    private int makerId;
    @NotBlank(message = "{validation.ProductBean.name.NotBlank.message}")
    private String name;
    private String image1;
    private String image2;
    private String image3;
    private String image4;
    private String content;
    @Min(value = 0, message = "{validation.ProductBean.name.Min.message}")
    private int orderId;
    private int deleteFlg;
    private Date date;
    private Date update;
    private Part file1 = null;
    private Part file2 = null;
    private Part file3 = null;
    private Part file4 = null;
    boolean deleteFlgBool = false;
    // using to decide update or not update productList
    private int flag = 0;

    List<Product> productList = null;
    private Product selectedProduct = null;

    // variable to check if image is deleted
    private boolean delImage1 = false;
    private boolean delImage2 = false;
    private boolean delImage3 = false;
    private boolean delImage4 = false;

    private String nameSearch;

    private int makerIdSearch;

    /**
     * Creates a new instance of ProductViewBean
     */
    public ProductViewBean() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getMakerId() {
        return makerId;
    }

    public void setMakerId(int makerId) {
        this.makerId = makerId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImage1() {
        return image1;
    }

    public void setImage1(String image1) {
        this.image1 = image1;
    }

    public String getImage2() {
        return image2;
    }

    public void setImage2(String image2) {
        this.image2 = image2;
    }

    public String getImage3() {
        return image3;
    }

    public void setImage3(String image3) {
        this.image3 = image3;
    }

    public String getImage4() {
        return image4;
    }

    public void setImage4(String image4) {
        this.image4 = image4;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    public int getDeleteFlg() {
        return deleteFlg;
    }

    public void setDeleteFlg(int deleteFlg) {
        this.deleteFlg = deleteFlg;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Date getUpdate() {
        return update;
    }

    public void setUpdate(Date update) {
        this.update = update;
    }

    public Part getFile1() {
        return file1;
    }

    public void setFile1(Part file1) {
        this.file1 = file1;
    }

    public Part getFile2() {
        return file2;
    }

    public void setFile2(Part file2) {
        this.file2 = file2;
    }

    public Part getFile3() {
        return file3;
    }

    public void setFile3(Part file3) {
        this.file3 = file3;
    }

    public Part getFile4() {
        return file4;
    }

    public void setFile4(Part file4) {
        this.file4 = file4;
    }

    public boolean isDeleteFlgBool() {
        return deleteFlgBool;
    }

    public void setDeleteFlgBool(boolean deleteFlgBool) {
        this.deleteFlgBool = deleteFlgBool;
    }

    public int getFlag() {
        return flag;
    }

    public void setFlag(int flag) {
        this.flag = flag;
    }

    public List<Product> getProductList() {
        return productList;
    }

    public void setProductList(List<Product> productList) {
        this.productList = productList;
    }

    public Product getSelectedProduct() {
        return selectedProduct;
    }

    public void setSelectedProduct(Product selectedProduct) {
        this.selectedProduct = selectedProduct;
    }

    public boolean isDelImage1() {
        return delImage1;
    }

    public void setDelImage1(boolean delImage1) {
        this.delImage1 = delImage1;
    }

    public boolean isDelImage2() {
        return delImage2;
    }

    public void setDelImage2(boolean delImage2) {
        this.delImage2 = delImage2;
    }

    public boolean isDelImage3() {
        return delImage3;
    }

    public void setDelImage3(boolean delImage3) {
        this.delImage3 = delImage3;
    }

    public boolean isDelImage4() {
        return delImage4;
    }

    public void setDelImage4(boolean delImage4) {
        this.delImage4 = delImage4;
    }

    public String getNameSearch() {
        return nameSearch;
    }

    public void setNameSearch(String nameSearch) {
        this.nameSearch = nameSearch;
    }

    public int getMakerIdSearch() {
        return makerIdSearch;
    }

    public void setMakerIdSearch(int makerIdSearch) {
        this.makerIdSearch = makerIdSearch;
    }

}
